{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=631
  Verdict: Accepted
}
var i,n,k,v,cur,j,tek:longint; res:int64; t,p,s:array[1..110] of longint; a:array[-2..30010,-2..110] of longint;
procedure qsort(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=t[(l+r) div 2];
repeat
      while t[i]<x do inc(i);
      while t[j]>x do dec(j);
      if i<=j then begin
         y:=t[i];
         t[i]:=t[j];
         t[j]:=y;
         y:=s[i];
         s[i]:=s[j];
         s[j]:=y;
         y:=p[i];
         p[i]:=p[j];
         p[j]:=y;
         inc(i);
         dec(j);
      end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
function max(a,b,c:longint):longint;
begin
if (a>=b) and (a>=c) then result:=a else
if (b>=a) and (b>=c) then result:=b else result:=c;
end;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
fillchar(a,sizeof(a),0);
readln(n,k,v);
for i:=1 to n do read(t[i]);
readln;
for i:=1 to n do read(p[i]);
readln;
for i:=1 to n do read(s[i]);
for i:=0 to n do fillchar(a[i],sizeof(a[i]),0);
qsort(1,n);
cur:=1;
res:=0;
for i:=0 to v do begin
    for j:=0 to k do a[i][j]:=max(a[i-1][j-1],a[i-1][j],a[i-1][j+1]);
    while t[cur]=i do begin
          if (s[cur]<=i) then inc(a[i][s[cur]],p[cur]);
          inc(cur);
    end;
end;
for i:=1 to v do
    for j:=1 to k do if a[i][j]>res then res:=a[i][j];
writeln(res);
end.